package com.dbapp.shopping.data;

import com.dbapp.shopping.domain.Record;
import com.dbapp.shopping.domain.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface RecordRepository
    extends CrudRepository<Record, Long> {

    @Query("select r from Record r where display = true and buyer = ?1 or seller = ?1")
    List<Record> findByUser(User user);
}
